package com.cfoco.component;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.cfoco.entity.Breeder;
import com.cfoco.service.BreederService;
import org.apache.commons.lang.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sun.util.locale.provider.FallbackLocaleProviderAdapter;

/**
 * @author syd
 * @create 2020-09-08 11:35
 */
@Component
public class EmployeeValidation implements IExcelVerifyHandler<Breeder> {
    @Autowired
    private BreederService breederService;

    @Override
    public ExcelVerifyHandlerResult verifyHandler(Breeder breeder) {

        Breeder byNo = breederService.findByNo(breeder.getUsername());
        if(byNo!=null){
            return new ExcelVerifyHandlerResult(true);
        }

        return new ExcelVerifyHandlerResult(false,"用户已存在请核实!");
    }
}
